]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Create app folder where the drop happened
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Wed, 27 May 2020 01:29:29 +0000 (22:29 -0300)
committerFlorian Müllner <florian.muellner@gmail.com>
Mon, 20 Jul 2020 16:13:20 +0000 (16:13 +0000)
Create the app folder where the icon we drop at is located. This
ensures the folder icon doesn't go into the last page, hidden and
solitary.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284

js/ui/appDisplay.js

index 0e14d376c1b6aa205002c75d923fe819f649dbf3..65d41fa530ba0417cdd2198015e43fcb1484be8c 100644 (file)
@@ -1126,6 +1126,11 @@ class AppDisplay extends BaseAppView {
             return false;
         }
 
+        // The hovered AppIcon always passes its own id as the first
+        // one, and this is where we want the folder to be created
+        const [folderPage, folderPosition] =
+            this._grid.getItemPosition(this._items.get(apps[0]));
+
         let appItems = apps.map(id => this._items.get(id).app);
         let folderName = _findBestFolderName(appItems);
         if (!folderName)
@@ -1136,7 +1141,12 @@ class AppDisplay extends BaseAppView {
         newFolderSettings.set_strv('apps', apps);
         newFolderSettings.apply();
 
-        this.selectApp(newFolderId);
+        this._redisplay();
+
+        // Move the folder to where the icon target icon was
+        const folderItem = this._items.get(newFolderId);
+        this._moveItem(folderItem, folderPage, folderPosition);
+        this._savePages();
 
         return true;
     }